package com.example.web.service.server.springbootwebserviceserver.server.impl;

import com.example.web.service.server.springbootwebserviceserver.server.dto.TestBean;
import com.example.web.service.server.springbootwebserviceserver.server.MockWebServiceMethod;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 * TestService.
 *
 * @author <a href='mailto:likeguo@apache.com'> likeguo </a>
 */
@Slf4j
@WebService(name = "TestService")
@Service
public class TestServiceImpl implements MockWebServiceMethod {
    
    @Override
    @WebMethod
    public TestBean getTest() {
        return TestBean.builder()
                .id(1)
                .name("Tom")
                .desc("Hello~ I'm Tom")
                .build();
    }
    
    @Override
    @WebMethod
    public TestBean getTest2(@WebParam(name = "test2", targetNamespace = "http://server.springbootwebserviceserver.server.service.web.example.com/") TestBean testBean) {
        log.info("getTest2:  param{}", testBean);
        testBean.setDesc("test2");
        return testBean;
    }
    
    @Override
    @WebMethod
    public TestBean getTest3(@WebParam(name = "test3", targetNamespace = "http://server.springbootwebserviceserver.server.service.web.example.com/") String testBean) {
        return TestBean.builder()
                .id(1)
                .name(testBean)
                .desc("Hello~ I'm Tom")
                .build();
    }
    
}
